import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class SmartTravelAgent {
	// single directional road
	private static class Road {
		int sc; // source city
		int tc; // target city
		int p; // maximum number of passengers that can be carried by the bus service from the source city sc to the target city tc
		public Road(int sc, int tc, int p) {
			this.sc = sc;
			this.tc = tc;
			this.p = p;
		}
	}
	private static class PathNode {
		int cc; // current city
		int p; // max passengers that can travel to current city cc from source city S, < 0 means infinity
		int pc; // previous city, 0 means no previous city, when cc = S pc will be 0
		boolean d; // best path to current city cc is done
		String path; // path from source city S to current city cc
		public PathNode(int cc, int p, int pc) {
			this.cc = cc;
			this.p = p;
			this.pc = pc;
		}
	}
	/**
	 * returns PathNode corresponding to the city whose p is max and d is false
	 * @param nodes
	 * @return
	 */
	private static int getMaxUndoneNode(PathNode nodes[]) {
		int maxUndoneCity = 0, maxP = 0;
		for(PathNode node : nodes) {
			if(node != null && !node.d && (node.p < 0 || node.p > maxP)) { // < 0 means infinity
				if(node.p < 0) // < 0 means infinity
					return node.cc;
				maxUndoneCity = node.cc;
				maxP = node.p;
			}
		}
		return maxUndoneCity;
	}
	private static PathNode getBestPathNode(List<Road>[] roads, int S, int D) {
		PathNode nodes[] = new PathNode[roads.length];
		nodes[S - 1] = new PathNode(S, -1, 0); // -1 means infinity, 0 means none
		int cc;
		while((cc = getMaxUndoneNode(nodes)) != D) {
			nodes[cc - 1].d = true;
			nodes[cc - 1].path = (nodes[cc - 1].pc > 0 ? (nodes[nodes[cc - 1].pc - 1].path + " ") : "") + cc;
			for(Road r : roads[cc - 1]) {
				if(nodes[r.tc - 1] == null)
					nodes[r.tc - 1] = new PathNode(r.tc, 0, 0);
				int p = nodes[cc - 1].p < 0 ? r.p : Math.min(nodes[cc - 1].p, r.p); // < 0 means infinity
				if(nodes[r.tc - 1].p < p) {
					nodes[r.tc - 1].p = p;
					nodes[r.tc - 1].pc = cc;
				}
			}
		}
		nodes[D - 1].d = true;
		nodes[D - 1].path = nodes[D - 1].pc > 0 ? (nodes[nodes[D - 1].pc - 1].path + " " + D) : "" + D;
		return nodes[D - 1];
	}
	public static void main(String[] args) throws IOException {
		BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));
		try {
			String[] NR = rdr.readLine().split(" ");
			int N = Integer.parseInt(NR[0]);
			int R = Integer.parseInt(NR[1]);
			List<Road> roads[] = new List[N];
			for(int r = 0; r < R; r++) {
				String roadTok[] = rdr.readLine().split(" ");
				int c1 = Integer.parseInt(roadTok[0]);
				int c2 = Integer.parseInt(roadTok[1]);
				int p = Integer.parseInt(roadTok[2]);
				
				// add road from c1 to c2
				Road road = new Road(c1, c2, p);
				if(roads[c1 - 1] == null)
					roads[c1 - 1] = new ArrayList<Road>();
				roads[c1 - 1].add(road);
				
				// add road from c2 to c1
				road = new Road(c2, c1, p);
				if(roads[c2 - 1] == null)
					roads[c2 - 1] = new ArrayList<Road>();
				roads[c2 - 1].add(road);
			}
			String[] SDT = rdr.readLine().split(" ");
			int S = Integer.parseInt(SDT[0]);
			int D = Integer.parseInt(SDT[1]);
			int T = Integer.parseInt(SDT[2]);
			PathNode node = getBestPathNode(roads, S, D);
			System.out.println(node.path);
			System.out.println(node.p < 0 ? 0 : (long)Math.ceil(T * 1.0 / (node.p - 1))); // < 0 means infinity
		} finally {
			rdr.close();
		}
	}
}
